package com.hq.fxh.Utils;

import java.math.BigDecimal;

/**
 * @author 小谢
 * @ClassName LongNumTransUtils
 * @Description :
 * @Created 2017/4/10 0010
 */
public class LongNumTransUtils {
    private static final int LIMIT_NUM = 100000;

    public static Object[] calculateNum(long num) {
        Object[] des = new Object[2];
        if (num > LIMIT_NUM) {
            des[1] = "万";
            float count = ((float) num) / 10000;
            BigDecimal bigDecimal = new BigDecimal(count);
            float result = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
            des[0] = result;
        } else {
            des[1] = "";
            des[0] = num;
        }
        return des;
    }

    public static Object[] calculateNum(int num) {
        Object[] des = new Object[2];
        if (num > LIMIT_NUM) {
            des[1] = "万";
            float count = ((float) num) / 10000;
            BigDecimal bigDecimal = new BigDecimal(count);
            float result = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
            des[0] = result;
        } else {
            des[1] = "";
            des[0] = num;
        }
        return des;
    }
}
